package cn.java.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.java.entity.User;

@Controller  //普通类FrontServlet加上@Controller注解，FrontServlet就变成了一个Servlet
public class FrontController {
	
	//@RequestMapping:为当前方法配置一个对外访问的虚拟路径
	//加上@RequestMapping注解后，Login()方法就可以当做doGet和doPost来用
	@RequestMapping(value={"/login.html","a.html","b.htm"})//@RequestMapping可配置多个虚拟路径，用逗号分隔
	public void Login(User user){
		System.out.println("登录成功");
		System.out.println(user);
	}
	
	//method=RequestMethod.POST指定只能支持POST方法
	@RequestMapping(value="/regiter.htm",method=RequestMethod.POST)
	public String regiter(User user){
		System.out.println(user);
		System.out.println("注册成功");
		return "/success.jsp"; //转发success.jsp页面
	}
	
}
